from django.db import models


class UserBaseInfo(models.Model):
    username = models.CharField(max_length=30, unique=True)
    password = models.CharField(max_length=20)
    status = models.CharField(max_length=1)
    createdate = models.DateTimeField(auto_now_add=True)


class UserExtraInfo(models.Model):
    data = models.TextField()
    user = models.OneToOneField(UserBaseInfo, on_delete=models.CASCADE)


class CardInfo(models.Model):
    card_id = models.CharField(max_length=30, unique=True)
    card_type = models.CharField(max_length=1)
    card_name = models.CharField(max_length=30)
    card_desc = models.CharField(max_length=200)
    card_price = models.IntegerField()
    card_status = models.CharField(max_length=1)
    user = models.ForeignKey(UserBaseInfo, on_delete=models.CASCADE, related_name='cards')


class SkillInfo(models.Model):
    user = models.ManyToManyField(UserBaseInfo, related_name='skills')
